package oop.day07.money;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 零钱类
 */
public class SamllChange {
    // 属性
    double balance;// 余额
    static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm");

    // 行为

    // 支出 消费
    public  void expenses(double money){
        if (balance>=money){
            balance=balance-money;
            Date date = new Date();
            String dateString = sdf.format(date);
            String details=dateString+"  消费"+money+"余额还剩:"+balance;
            System.out.println(details);
            return;
        }
        System.out.println("余额不足");

    }
    // 转入
    public void  save(double money){
        balance +=money;
        Date date = new Date();
        String dateString = sdf.format(date);
        System.out.println(dateString+"存入零钱成功，余额还有"+balance);
    }


}
